package com.tanhua.server.controller;

import com.tanhua.dubbo.pojo.Report;
import com.tanhua.dubbo.vo.TestSoulVo;
import com.tanhua.server.service.TestSoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/testSoul")
public class TestSoulController {

    @Autowired
    private TestSoulService testSoulService;

    /**
     * 测灵魂-问卷列表
     * @return
     */
    @GetMapping
    public List<TestSoulVo> QuestionList() {
        return this.testSoulService.questionList();
    }

    /**
     * 测灵魂-提交问卷
     * @param param
     * @return
     */
    @PostMapping
    public String submitQuestionList(@RequestBody Map<String,List<Map<String,String>>> param) {
        return this.testSoulService.submitQuestionList(param);
    }

    /**
     * 测灵魂-查看结果
     * @param reportId 报告id
     * @return 报告
     */
    @GetMapping("/report/{reportId}")
    public Report queryReport(@PathVariable("reportId") String reportId) {
        return this.testSoulService.queryReport(reportId);
    }
}
